/**
 * 
 */
package pa2;

import java.rmi.Remote;
import java.rmi.RemoteException;


/**
 * @author Joerg Poecher
 *
 */
public interface IMyKVPeer extends Remote {
	
	public final int NUM_OF_MAX_HOPS = 5; // == 6 Levels
	public final int NUM_OF_PEERS = 4;
	public final long MAX_KEY_VALUE = (long) Math.pow(2, 31)-1;
//	public final long MAX_KEY_VALUE = (long) Math.pow(2, 5)-1;
	
	public final String SERVICENAME = "pa2.Peer";
	
	// returns the number of the Peer on which the value is stored, or a -1 if not successful
	public long insert(MyKVMessage msg) throws RemoteException;
	
	// returns the value to a given key, or null if it does not exist.
	public String lookup(MyKVMessage msg) throws RemoteException;
	
	// deletes a key/value pair and returns true on success, or false if it could not been found.  
	public boolean delete(MyKVMessage msg) throws RemoteException;
	
	public void setLeftChild(IMyKVPeer peer) throws RemoteException;

	public void setRightChild(IMyKVPeer peer) throws RemoteException;
	
	// dummy method for checking if available
	public String say() throws RemoteException;
	
	// dummy method for statistics
	public int getAccessCounter() throws RemoteException;
	
	// peer number
	public int getPeerNumber() throws RemoteException;
	
	// returns the number of entries in the storage
	public int getStorageSize() throws RemoteException;
	

}
